1. Field of the Invention
This invention relates to a process of patching by comparing object files. In particular, this invention relates to a method and apparatus for creating a software patch using the object files of two software sources to create individual reduced program dependency graphs and comparing these reduced program dependency graphs to determine a minimal set of changes for the patching process.
2. Description of the Problem Solved
xe2x80x9cSoftware patchxe2x80x9d is a term which refers to a software file, generally a binary file, that comprises data or instructions to upgrade an old version of a software program to a new version of that same software program. The existing process of producing patches for computer programs such as C/C++ traditionally is very tightly coupled to a particular process and the particular behavior of a specific toolset, i.e., compiler, linker and assembler. There is little cohesiveness amongst toolsets available for development. For example, they may not support the same syntax for C or assembly, may not generate object files in the same format, and may not provide the same functionality. Lack of uniformity of standards causes problems in portability of applications among toolsets. Also, software developers will typically develop software patches specific to code written in C/C++ languages rather than developing the patches to be language independent. While technology exists that is used to create patches for a variety of manufacturers, it is future limited, difficult to maintain and requires parallel strategies and processes to support patching code written in other languages even for the same product or the same logical in-field update.
In general, a patch-writer, the person who develops a patch, typically is creates a patch by comparing the code of an old software program with the code of an updated version of the program and determining the upgraded changes. The resulting software patch, therefore, essentially comprises only the changes contained in the new software program that are not found in the old software program. Typically, a patch-writer will create the software patch at his desktop computer or workstation. The patch is then physically taken to a computer system, installed on a disc or storage medium having the old software program to be upgraded, and is installed or downloaded onto the computer. Alternatively, a patch may be electronically delivered to a computer system through a communications network, e.g., the Internet.
A patch, when applied to a computer system, will change the behavior of the computer system from the old version of the software to the upgraded or new version of the software. A patch can be installed, downloaded or delivered to a computer system and thereby upgrade the software without taking the computer system off-line. Patching, therefore, as defined above, is typically used to upgrade existing software of a computer system in the field, where changes must be made without interrupting the operations of the computer system. For example, a computer at a telephone switch is in constant use, i.e., connecting telephone calls, and therefore, cannot be conveniently pulled off-line to have its software upgraded. Thus, the software patch may be utilized to upgrade the computer software without interrupting its operations.
The benefits, therefore, of patching software versus updating a computer system""s software in its entirety are several. First, patching produces a small fix for a small software error and thus is a quick way to deliver and administer xe2x80x9cquick fixes,xe2x80x9d particularly in emergency situations. Patching also provides a way to change the software on-the-fly, so that the entire system need not be taken out-of-service and reloaded. Finally, patching can be implemented to provide a mechanism called xe2x80x9cactivatable patchesxe2x80x9d. The term, activatable patches, as used herein means patches which may be turned on and off while the program is being utilized as deemed appropriate by a patch-writer. This essentially allows the system to have two possible behaviors for a particular functionality, patches that are either in the on or off state. Computer programs are generally written in high level languages, such as FORTRAN, C/C++, Pascal, and BASIC. A computer programmer writes programs in a high level language to direct the computer to execute certain commands. Commands in a high level language are relatively easy to learn and users can run many programs on many different computers using the same high level language commands. Computers, on the other hand, cannot execute commands from a high level language. Typically, the microprocessor understands and executes commands using only a set of commands unique to the computer. The high level language must be compiled, that is, translated, from the high level language to a machine readable language computers can understand.
Compiling a program written in a high level language to machine executable object code is well known in the art. After the entire program is written in the high level language, the user requests that the program be compiled for execution in machine language. A software program known as a compiler reads the commands and data in the high level language and generates an object file having machine readable code corresponding to the commands of the high level language.
Traditionally telecommunications companies had control over the software that was used on computer systems in the field. Telecommunications companies wrote their own proprietary software tools to control the computer systems and developed their own internal compilers to translate software into machine code which can be understood and acted upon by a computer. Such companies, therefore, had total control over the computer system hardware, the software, and the process of developing and upgrading software, including creating patches.
However, with the evolution of new software languages and the rapidly improving technology of compilers producing faster and smaller code, many companies now do not have the luxury of developing and using their own proprietary languages to control computer systems, but have had to yield to market pressure and use languages, such as C/C++, which are today""s mainstream programming languages. This has made the job of controlling a computer system""s software and creating patches more difficult. Given that C/C++ is the preferred and commonly used software language and that telecommunications companies generally purchase off the shelf compilers for programs written in C/C++, there is no direct way to develop and create a patch for software programs written in C/C++ languages.
The known method of creating patches for software modules written in C/C++ languages is very difficult to maintain and time consuming. For example, to create a patch for programs written in C/C++ languages, a patch-writer must: 1) compile the software into an intermediate language, the assembly language, and 2) perform an analysis on that language. Under this method, the patch-writer would have to take the entire software package and analyze all of the software programs to determine the changes for the patching process. In addition, to create a patch using the assembly language, the patch writer must compare each textual line in the old software program to each corresponding textual line in the upgraded version of the software program. Because of numerous branching sequences which jump to various places in a program, it is difficult to create a patch by making line-by-line comparisons of programs with branching sequences. For example, the assembly language of an old software program may comprise a first function and a second function in numerical order. Although the assembly language of the new upgraded software program might comprise the same first and second functions, they might be in reverse order. The patch writer, therefore, might not be able to readily determine that the functions in the old assembly language and the new assembly language are the same. As the need for software patches has increased, the sophistication of the development of processes to create patches has not kept pace.
What is needed is an efficient and reliable method and apparatus for creating a patch for software by determining a minimal set of changes known as deltas. Optimally, the process will permit source-language target processor and compiler vendor independence. The method and apparatus is needed to create patches from the assembly language of software by comparing the object files, the actual machine language of the software. The foregoing problems are solved by a method apparatus that function to compile an old version of a software program and an upgraded version into separate object files. The object files then are decomposed into nodes or xe2x80x9ccantlesxe2x80x9d, and are used to generate separate reduced program dependency graphs (RPDG) for both software programs. The RPDG include a plurality of nodes that are linked together. The two RPDG""s are compared to determine the minimal upgraded changes and create a patch therefrom comprising of the changed or added functions.
It is therefore an object of this invention to provide a method and apparatus that creates a patch using object files of programs written in high level languages such as C/C++ instead of creating a patch from a processor and compiler vendor specific intermediate representation such as assembly.
It is another object of this invention to provide a method and apparatus that creates a patch by decomposing object files into nodes or cantles.
It is another object of this invention to provide a method and apparatus that creates a patch by comparing RPDG""s.
It is another object of this invention to provide a method and apparatus that creates a patch by comparing functions of an object file of an old software program component to functions of an object file of a new upgraded software program component.
It is another object of this invention to provide a method and apparatus that is source-code independent and can be applied to code written in C/C++, Pascal or even to specific proprietary languages.
It is another object of this invention to efficiently create a patch to update existing software on a computer system without having to pull the computer off-line.
The present invention solves the above mentioned problems by providing a method and apparatus for creating software patches for software programs written in C/C++, Pascal or specific proprietary languages so long as they compile to a standard object file format. Functions of a compiled version of an existing software program are compared with an updated version that is compiled in separate object files to discover a minimal set of changes, or xe2x80x9cdeltasxe2x80x9d (for the patching process). Object files themselves typically include a single module for a larger program. Because the software has already been compiled into object files, the invention is source-code independent and can be applied to code written in C/C++, Pascal or even to specific proprietary languages. The process for creating a patch from the object file, includes, first, decomposing each object file into cantles, partitioning relocation information (which we call fix-up information or fix-ups), and associating it with the various cantles. Next, the steps of examining each cantle and adding fix-ups for any references to other cantles, constructing a reduced program dependency graph (RPDG) from the cantles (nodes) and their fix-ups (edges) for each object file, and comparing the two RPDG""s to determine the differences between their functions are performed. Finally, a listing of differences between the functions of the two RPDG""s is developed and a patch comprised of the listed differences between the functions of the two RPDG""s is developed.
With the present invention, the old software and new software are compiled into individual object files as commonly known. The object files of the old software code and new software code contain data, constants, and various artifacts of the source code. The term xe2x80x9ccantlesxe2x80x9d as used in this invention refers to the product produced from xe2x80x9ccantlization.xe2x80x9d Each object file undergoes a process called cantlization. The term xe2x80x9ccantlizationxe2x80x9d generally means the process of structuring of the object files into uniformed cantles (sub-parts) so that individual RPDG""s can be constructed for the old and new software codes. The cantles are actual functions from the original source (i.e., the code), variables and constants. Other information in the object files, called fix-ups, sometimes known in the art as relocations, are used to determine the dependencies between the various cantles.
A patch created under this invention is composed of mutually dependent functions. A function is actually a segment code in the object files. Since software patches will typically contain functions, in the preferred embodiment, the invention determines which functions are represented by is which cantles. From the fix-up information present in the object file, the invention can determine the dependencies of each function with respect to all other functions, variables, constants, etc., of the larger, whole program.
Individual reduced program dependency graphs are developed for the old and new object files. Each reduced program dependency graph is comprised of nodes. These nodes represent functions, variables, etc. The interconnections of the nodes are determined from fix-up information from the object file. The RPDG""s for the new and old software are compared to determine the differences between functions of the old and new software. As the RPDG""s are compared, the nodes are marked to determine which functions have changed in the old software code and/or which functions have been added to the new software code. These changes are captured, controlled, and the patch is automatically produced, generally, in a binary file format comprised of the changed functions only. The resulting patch produced in this manner can be sent to a computer in the field to upgrade the old version of a computer""s software.